<template>
    <elm-page-bb>
        <el-form ref="model" :model="model" size="small" label-width="120px">
            <elm-row>
              <el-form-item label="计划编号" prop="sys_code_key">
                <el-input v-model="model.sys_code_key" :disabled="true" placeholder="自动生成无需填写"></el-input>
              </el-form-item>
              <el-form-item label="计划名称" prop="name" :rules="[{ required: true, message: '工作名称必须填写'}]">
                  <el-input type="name" v-model="model.name"></el-input>
              </el-form-item>
            </elm-row>
            <el-form-item label="备注">
                <el-input type="textarea" v-model="model.remark" :rows="2"></el-input>
            </el-form-item>
        </el-form>
        <template #bottom>
            <el-button type="success" size="small" @click="submit" model.>立即保存</el-button>
            <el-button size="small" @click="close">取消</el-button>
        </template>
    </elm-page-bb>
</template>

<script>
export default {
    extends: elmVueBase,
    data() {
        return {
            model: {
                pid: elm.dialog.request.pid,
            },
        }
    },
    created() {
    },
    destroyed() {
      this.request.callVue.tablebinding();
    },
  methods: {
        async submit() {
          console.log(this.model);
            await this.$refs["model"].validate();
            var res = await elm.post('/business/plm/plan/Upsert', this.model);
            if (res == true) {
                this.close();
                this.v('保存成功。');
                this.request.callVue.tablebinding();
            }
            else {
                this.error('保存失败，请稍后尝试。');
            }
        },
    }
}
</script>

<style scoped>
</style>